<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <style>

        .el-tabs__item {
            padding: 0 35px;}
        .div_head{
            padding: 0;
            position:fixed;
            width: 100%;
            height: 4rem;
            right: 0;
            top:0;
            background-color:white;
            z-index: 55;
        }
        #head_span{
            display: block;
            margin: 9px 70px 0 0 ;
        }
        #head_span>a{
            text-decoration: none;
            color: #909399;
            margin-left: 20px;
        }
        #head_span a:hover{
            color: rgb(145, 160, 208);
        }

    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header>
            <div class="div_head">
            <el-menu mode="horizontal" background-color="white"
                     text-color="color: rgb(29, 56, 136)" active-text-color="color: rgb(29, 56, 136)" style="width:1200px;margin: 0 auto">
                <el-menu-item><img  height="50px" src="imgs/logo.png" alt=""></el-menu-item>
                <el-menu-item index="1">首页</el-menu-item>
                <el-menu-item index="2">蛋糕</el-menu-item>
                <el-menu-item index="3">下午茶</el-menu-item>
                <el-menu-item index="4">精选食材</el-menu-item>
                <el-menu-item index="5">最新活动</el-menu-item>
                <el-menu-item index="6">企业专区</el-menu-item>
                <el-menu-item index="6">会员中心</el-menu-item>
                <div style="float: right;position: relative; top: 10px">
                <span id="head_span">
                <a href="">登录 </a> <a href="reg.html"> 注册</a>
                    <a href=""><i class="el-icon-s-goods" style="margin-left: 10px"></i></a>
                </span>
                </div>
            </el-menu>
        </div>
        </el-header>

        <el-main>
            <el-form label-width="100px" style="width: 400px;margin: 50px auto">
                <el-tabs v-model="activeName" @tab-click="handleClick">
                    <el-tab-pane label="手机验证码登录" name="first" style="border: 1px">
                <el-row :gutter="20">
                    <el-col :span="6"> <el-form-item label="手机号码" style="position: relative;right: 16px"></el-form-item></el-col>
                    <el-col :span="18"><el-input type="text"></el-input></el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="6" > <el-form-item label="验证码"  style="position: relative;right: 30px"></el-form-item></el-col>
                    <el-col :span="8"><el-input type="text"></el-input></el-col>
                    <el-col :span="10" style="position:relative;left: 18px"> <canvas id="canvas" onclick="dj()" style="border: 1px solid #ccc;display: block;height: 37px;width: 135px"></canvas>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="6"> <el-form-item label="短信验证码"></el-form-item></el-col>
                    <el-col :span="8"><el-input type="text"></el-input></el-col>
                    <el-col :span="10" style="position:relative;left: 16px"> <el-button>获取短信验证码</el-button></el-col>
                </el-row>
                <el-button style="width: 100%;background-color: rgb(60,35,20);color: rgb(250,245,220)">登录</el-button>
                <el-form-item style="position: relative;left: 168px">
                    <a href="" style="text-decoration: none">忘记密码？</a>
                    <a href="/reg" style="text-decoration: none">立即注册</a>
                </el-form-item>
                    </el-tab-pane>
                    <el-tab-pane label="账号密码登录" name="second">
                        <el-row :gutter="20">
                            <el-col :span="6" style="position: relative;right: 25px"> <el-form-item label="账号名"></el-form-item></el-col>
                            <el-col :span="18"><el-input type="text"></el-input></el-col>
                        </el-row>
                        <el-row :gutter="20">
                            <el-col :span="6" style="position: relative;right: 39px"> <el-form-item label="密码"></el-form-item></el-col>
                            <el-col :span="18"><el-input type="password"></el-input></el-col>
                        </el-row>
                        <el-button style="width: 100%;background-color: rgb(60,35,20);color: rgb(250,245,220)">登录</el-button>
                        <el-form-item style="position: relative;left: 168px">
                            <a href="" style="text-decoration: none">忘记密码？</a>
                            <a href="/reg" style="text-decoration: none ">立即注册</a>
                        </el-form-item>
                    </el-tab-pane>
                    <el-tab-pane label="微信登录" name="third" style="text-align: center"><img src="imgs/二维码.jpg"></el-tab-pane>
                </el-tabs>

            </el-form>
        </el-main>

        <el-footer>
            <div style="background-color: #282c30;color: #666666;text-align: center;padding: 50px 0">
                <p>有家蛋糕 提前3小时预订，北京市六环内免费配送 公司地址：北京市朝阳区798艺术区工美楼3层</p>
                <p>Copyright © 2009-2023 ebeecake有家蛋糕 有家（北京）食品有限公司 京ICP备09081733号-1 <img src="https://cdn.tmooc.cn/tmooc-web/css/img/beianh2019082901.png"> 京公网安备 11010802029572号</p>
                <p>公司电话：4006106798    食品经营许可证：JY11105110232865    食品生产许可证：SC12411051114584</p>
            </div>
        </el-footer>
    </el-container>
</div>
</body>

<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    var show_num = [];
    draw(show_num);

    function dj() {
        draw(show_num);
    }

    function sublim() {
        var val = document.getElementById("text").value;
        var num = show_num.join("");
        if (val == '') {
            alert('请输入验证码！');
        } else if (val == num) {
            alert('提交成功！');
            document.getElementById(".input-val").val('');
            draw(show_num);

        } else {
            alert('验证码错误！\n你输入的是:  ' + val + "\n正确的是:  " + num + '\n请重新输入！');
            document.getElementById("text").value = '';
            draw(show_num);
        }



    }

    function draw(show_num) {
        var canvas_width = document.getElementById('canvas').clientWidth;
        var canvas_height = document.getElementById('canvas').clientHeight;
        var canvas = document.getElementById("canvas"); //获取到canvas的对象，演员
        var context = canvas.getContext("2d"); //获取到canvas画图的环境，演员表演的舞台
        canvas.width = canvas_width;
        canvas.height = canvas_height;
        var sCode =
            "A,B,C,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m";
        var aCode = sCode.split(",");
        var aLength = aCode.length; //获取到数组的长度

        for (var i = 0; i <= 3; i++) {
            var j = Math.floor(Math.random() * aLength); //获取到随机的索引值
            var deg = Math.random() * 30 * Math.PI / 180; //产生0~30之间的随机弧度
            var txt = aCode[j]; //得到随机的一个内容
            show_num[i] = txt;
            var x = 10 + i * 20; //文字在canvas上的x坐标
            var y = 20 + Math.random() * 8; //文字在canvas上的y坐标
            context.font = "bold 23px 微软雅黑";

            context.translate(x, y);
            context.rotate(deg);

            context.fillStyle = randomColor();
            context.fillText(txt, 0, 0);

            context.rotate(-deg);
            context.translate(-x, -y);
        }
        for (var i = 0; i <= 5; i++) { //验证码上显示线条
            context.strokeStyle = randomColor();
            context.beginPath();
            context.moveTo(Math.random() * canvas_width, Math.random() * canvas_height);
            context.lineTo(Math.random() * canvas_width, Math.random() * canvas_height);
            context.stroke();
        }
        for (var i = 0; i <= 30; i++) { //验证码上显示小点
            context.strokeStyle = randomColor();
            context.beginPath();
            var x = Math.random() * canvas_width;
            var y = Math.random() * canvas_height;
            context.moveTo(x, y);
            context.lineTo(x + 1, y + 1);
            context.stroke();
        }
    }

    function randomColor() { //得到随机的颜色值
        var r = Math.floor(Math.random() * 256);
        var g = Math.floor(Math.random() * 256);
        var b = Math.floor(Math.random() * 256);
        return "rgb(" + r + "," + g + "," + b + ")";
    }

    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                user:{username:"",password:""},
                activeName: 'first',
                activeIndex: '1'
            }
        },
        methods:{
            handleClick(tab, event) {
                console.log(tab, event);
            },
            handleSelect(key,keyPath){
                console.log(key,keyPath);
            }

        }
    })
</script>
</html>